package utils

import (
	"fmt"
	"os"
	"strings"
)

func GetUserHome() string {
	homeDir, err := os.UserHomeDir()
	if err == nil {
		return homeDir
	}
	return ""
}
func GetDefaultJdkVersion() string {
	version, err := ExecSh("/usr/libexec/java_home")
	if err != nil {
		fmt.Println("Unable to get default version:" + err.Error())
	}
	version = strings.Replace(version, "/Library/Java/JavaVirtualMachines/", "", -1)
	version = strings.Replace(version, "/Contents/Home", "", -1)
	version = strings.Replace(version, "\n", "", -1)
	return version
}
